package com.jcroke.hercules.examples;

public class dBoolean extends Datum {
	
	public dBoolean() throws DatumException {
		super(Boolean.class, 0);
	}
	
	public dBoolean(Boolean value) throws DatumException {
		super(Boolean.class, value);
	}
	
	public dBoolean(Class<?> type, Boolean value) throws DatumException {
		super(Boolean.class, value);
	}

	@Override
	public boolean isNull() throws DatumException {
		return (this.value == null);
	}
	
	@Override
	public boolean not(Object val) throws DatumException {
		return !(((dBoolean)val).getValue().booleanValue());
	}
	
	@Override
	public boolean not() throws DatumException {
		return !(Boolean)this.value;
	}

	@Override
	public boolean and(Object val) throws DatumException {
		this.value = (Boolean) this.value && ((dBoolean) val).getValue();
		return ((Boolean) this.value).booleanValue();
	}

	@Override
	public boolean or(Object val) throws DatumException {
		this.value = (Boolean)this.value || ((dBoolean)val).getValue();
		return ((Boolean)this.value).booleanValue();
	}

	@Override
	public Class<?> getType() {
		return Boolean.class;
	}
	
	@Override
	public Boolean getValue() {
		return (Boolean)this.value;
	}
}
